#ifndef HISTORYDIALOG_H
#define HISTORYDIALOG_H

#include <QDialog>

#include <QDate>
#include <QStyledItemDelegate>

class DateFormatDelegate : public QStyledItemDelegate
{
public:
 DateFormatDelegate (QString dateFormat, QObject *parent = 0) :
  QStyledItemDelegate(parent),
  m_dateFormat(dateFormat)
 {
 }

 virtual QString displayText(const QVariant & value, const QLocale & locale ) const
 {
  Q_UNUSED(locale);
     QDateTime dt;
     dt.setTime_t(value.toInt());
  return dt.toString(m_dateFormat);
 }

private:
 QString m_dateFormat;
};

namespace Ui {
class HistoryDialog;
}

class HistoryDialog : public QDialog
{
    Q_OBJECT
    
public:
    explicit HistoryDialog(QWidget *parent = 0);
    ~HistoryDialog();

private slots:
    void setupData();
    void on_start_dateEdit_dateChanged(const QDate &date);

    void on_end_dateEdit_dateChanged(const QDate &date);

private:
    void setupDatabase();
    void setupGraph();
    void setupDates();

    Ui::HistoryDialog *ui;
};

#endif // HISTORYDIALOG_H
